package me.jiatao.viewbinding

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.hi.dhl.binding.viewbind
import me.jiatao.viewbinding.databinding.ActivityMainBinding
import me.jiatao.viewbinding.databinding.ViewMergeBinding

class MainActivity : AppCompatActivity() {

    private val binding by viewbind<ActivityMainBinding>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(binding.root)

        binding.viewIncludeId.includeText.text = "通过绑定赋值"

        // binding.viewIncludeId.root 为外部view_include的根View
        val viewMergeBinding = ViewMergeBinding.bind(binding.viewIncludeId.root)
        viewMergeBinding.mergeText.text = "通过绑定赋值"
    }
}